interface People {
	name: string;
	age: number;
}

// 类
// 同时也是一个类型 { name: string, setName(name: string): void }
// 类实现接口
class Person implements People {
	name: string;
	age: number;
	constructor(name: string, age: number) {
		this.name = name;
		this.age = age;
	}
	setName(name: string) {
		this.name = name;
	}
}

// const obj: Person = {
// 	name: "jack",
// 	setName(name: string) {
// 		this.name = name;
// 	},
// };

// const p = new Person("tom");

// 接口继承类
interface P extends Person {
	sex: string;
}

const p: P = {
	name: "jack",
	age: 18,
	sex: "男",
	setName(name: string) {
		this.name = name;
	},
};

// 接口继承接口
interface P1 extends People {
	sex: string;
}

const p1: P1 = {
	name: "jack",
	age: 18,
	sex: "男",
};
